import unittest
import requests


class TestHrLogin(unittest.TestCase):
    def test_login_ok(self):
        url_login = "http://localhost:8080/api/sys/login"
        data = {"mobile": "13800000002", 'password': "123456"}

        # 创建Session
        session = requests.session()
        url_cookie = 'http://localhost:8080/api/sys/login'
        session.get(url_cookie)

        session.get(url_cookie)  # 请求验证码链接，服务器记录信息

        resp =session.post(url_login,data)
        # resp = requests.post(url_login, data)  # 执行脚本
        # 断言状态码为200
        self.assertEqual(200,resp.status_code)
        print(resp.json())




